(function(s){s(window,"undefined"===typeof window._acic?{}:window._acic,"undefined"===typeof window._aci_action?null:window._aci_action,"undefined"===typeof window._aci_debug?!1:window._aci_debug)})(function(s,m,n,w){function u(a){this.debug=!!a;this.available=this.isAvailable()}function l(a){u.call(this,a)}function p(a){u.call(this,a)}function x(a){this.debug=!!a}function g(){if(!(this instanceof g))return new g;this.version="0.2.1";this.urlHit="//www.acint.net/hit/";this.urlAct="//www.acint.net/act/";
this.urlJump="//www.acint.net/jump/";this.urlPing="//www.acint.net/ping/";this.urlMatchCookie="//www.acint.net/mc/";this.urlRid="//dsp-rtb.sape.ru/getrid/";this.cookieName="aid";this.cookieValueOptOut="opt-out";this.cookieFp="fid";this.uidFp=this.uid="";this.presence={timeouts:[3E3,2E4],nofRequests:0};this.dspTrack={timeout:50,maxNofRequests:4,nofRequests:0,ready:!1,bidRequestId:""};this.action={timeout:500,timeoutEmpty:2E3,countPerCycle:3,index:0,methods:{register:"register"},userCanReset:["timeout",
"timeoutEmpty","countPerCycle"]};this.config={dataProvider:"",allowExtLinksTrack:!0,allowPresenceTrack:!0,allowCookieMatch:!0,allowDspTrack:!1,customData:null,action:null}}var r=!!w,v={};"object"==typeof JSON&&"function"==typeof JSON.stringify?v.stringify=function(a){return JSON.stringify(a)}:function(){function a(a){function b(a){return 10>a?"0"+a:a}if(a&&"object"==typeof a){if(a instanceof Date)return isFinite(a.valueOf())?a.getUTCFullYear()+"-"+b(a.getUTCMonth()+1)+"-"+b(a.getUTCDate())+"T"+b(a.getUTCHours())+
":"+b(a.getUTCMinutes())+":"+b(a.getUTCSeconds())+"Z":null;if(a instanceof String||a instanceof Number||a instanceof Boolean)return a.valueOf()}return a}function b(a){f.lastIndex=0;return f.test(a)?'"'+a.replace(f,function(a){var b=d[a];return"string"===typeof b?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function c(f,d){var g,t,l,n,p=e,m,q=d[f],q=a(q);"function"===typeof k&&(q=k.call(d,f,q));switch(typeof q){case "string":return b(q);case "number":return isFinite(q)?String(q):
"null";case "boolean":case "null":return String(q);case "object":if(!q)return"null";e+=h;m=[];if("[object Array]"===Object.prototype.toString.apply(q)){n=q.length;for(g=0;g<n;g+=1)m[g]=c(g,q)||"null";l=0===m.length?"[]":e?"[\n"+e+m.join(",\n"+e)+"\n"+p+"]":"["+m.join(",")+"]";e=p;return l}if(k&&"object"===typeof k)for(n=k.length,g=0;g<n;g+=1)t=k[g],"string"===typeof t&&(l=c(t,q))&&m.push(b(t)+(e?": ":":")+l);else for(t in q)Object.prototype.hasOwnProperty.call(q,t)&&(l=c(t,q))&&m.push(b(t)+(e?": ":
":")+l);l=0===m.length?"{}":e?"{\n"+e+m.join(",\n"+e)+"\n"+p+"}":"{"+m.join(",")+"}";e=p;return l}}var f,e,h,d,k;"function"!==typeof v.stringify&&(f=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,d={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},v.stringify=function(a,b,f){var d;h=e="";if("number"===typeof f)for(d=0;d<f;d+=1)h+=" ";else"string"===typeof f&&(h=f);if((k=b)&&"function"!==typeof b&&
("object"!==typeof b||"number"!==typeof b.length))throw Error("JSONStub.stringify");return c("",{"":a})})}();var d={generateUUID:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0;return("x"==a?b:b&3|8).toString(16)}).toLowerCase()},stringTrimLimit:function(a){if(null==a)return"";a=a.replace(/\s+/gmi," ").replace(/^\s+|\s+$/g,"");1E3<a.length&&(a=a.substr(0,1E3));return a},padInt:function(a){return 10>a?"0"+a:""+a},getTimeZoneOffsetIso8601:function(){var a=
(new Date).getTimezoneOffset();return(0<a?"-":"+")+this.padInt(Math.floor(Math.abs(a)/60))+":"+this.padInt(Math.abs(a)%60)},getDateTimeIso8601:function(a){var b=new Date;return b.getFullYear()+"-"+this.padInt(b.getMonth()+1)+"-"+this.padInt(b.getDate())+"T"+this.padInt(b.getHours())+":"+this.padInt(b.getMinutes())+":"+this.padInt(b.getSeconds())+"."+String((b.getMilliseconds()/1E3).toFixed(3)).slice(2,5)+(!0===a?this.getTimeZoneOffsetIso8601:"")},isObject:function(a){return"object"===typeof a&&"[object Object]"===
Object.prototype.toString.call(a)},isArray:function(a){return"undefined"!==typeof Array.isArray?Array.isArray(a):"[object Array]"===Object.prototype.toString.call(a)},isEmptyObject:function(a){for(var b in a)return!1;return!0},isString:function(a){return"string"===typeof a||a instanceof String},encodeUriParam:function(a){if(null==a)return"";a=""+a;return encodeURIComponent instanceof Function?encodeURIComponent(a):escape(a)},implodeUriParams:function(a){var b,c=[];for(b in a)a.hasOwnProperty(b)&&
c.push(b+"="+a[b]);return c.join("&")},makeRequestUri:function(a,b){var c=d.implodeUriParams(b);8E3<c.length&&(c=c.substr(0,8E3));return a+"?"+c},makeRequestImage:function(a,b){var c=window.Image?new Image:document.createElement("img");c.src=a;b&&document.body.appendChild(c)},makeRequestScript:function(a){var b=document.createElement("script");b&&(b.setAttribute("src",a),document.body.appendChild(b))},makeRequestIframe:function(a){var b=document.createElement("iframe");b&&(b.setAttribute("src",a),
b.setAttribute("style","width:1px;height:1px;display:none;"),b.setAttribute("frameBorder","0"),b.setAttribute("width","0"),b.setAttribute("height","0"),document.body.appendChild(b))},addReadOnlyProperty:function(a,b,c){Object.defineProperty(a,b,{value:c,writeable:!1,enumerable:!0,configurable:!1})},addEventListenerCrossBrowser:function(a,b,c){if(a.addEventListener)a.addEventListener(b,c,!1);else if(a.attachEvent)a.attachEvent("on"+b,c);else throw"Cannot add event listener: no Event API support in client";
},removeEventListenerCrossBrowser:function(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,!1);else if(a.attachEvent)a.detachEvent("on"+b,c);else throw"Cannot remove event listener: no Event API support in client";},fireEventCrossBrowser:function(a,b){var c,f=document;if(f.createEvent){var e=null;switch(b){case "click":case "dblclick":case "mousedown":case "mouseup":case "mouseover":case "mousemove":case "mouseout":case "mouseenter":case "mouseleave":e="MouseEvent";break;case "wheel":e=
"WheelEvent";break;case "load":case "unload":case "abort":case "error":case "select":case "resize":case "scroll":e="UIEvent";break;case "focus":case "focusin":case "focusout":case "blur":e="FocusEvent";break;case "beforeinput":case "input":e="InputEvent";break;case "keydown":case "keyup":e="KeyboardEvent";break;case "compositionstart":case "compositionupdate":case "compositionend":e="CompositionEvent"}try{c=f.createEvent(e)}catch(d){try{c=f.createEvent("HtmlEvents")}catch(g){try{c=f.createEvent("Event")}catch(k){throw Error("Cannot create event object for specified event: "+
b);}}}c.initEvent(b,!0,!1);a.dispatchEvent(c)}else if(f.createEventObject)c=f.createEventObject(),c.eventType=b,a.fireEvent("on"+b,c);else if("function"==typeof a["on"+b])a["on"+b]()},fireSameEventCrosBrowser:function(a,b,c){var f=document,e;if(f.createEvent)try{e=new c.constructor(b,c),a.dispatchEvent(e)}catch(d){e=f.createEvent("MouseEvent"),e.initMouseEvent(c.type,!0,!0,window,0,c.screenX,c.screenY,c.clientX,c.clientY,c.ctrlKey,c.altKey,c.shiftKey,c.metaKey,c.button,c.relatedTarget||null),a.dispatchEvent(e)}else if(f.createEventObject)e=
f.createEventObject(c),e.eventType=b,a.fireEvent("on"+b,e);else if("function"==typeof a["on"+b])a["on"+b]()},bindOnReady:function(a){function b(){f||(f=!0,a())}function c(){if(!f)try{g.doScroll("left"),b()}catch(a){setTimeout(c,10)}}var f=!1,e=window,d=document,g=d.documentElement;if(d.addEventListener)d.addEventListener("DOMContentLoaded",b,!1);else if(d.attachEvent){try{var k=null!=e.frameElement}catch(m){}g.doScroll&&!k&&c();d.attachEvent("onreadystatechange",function(){"complete"===d.readyState&&
b()})}else if(e.addEventListener)e.addEventListener("load",b,!1);else if(e.attachEvent)e.attachEvent("onload",b);else{var l=e.onload;e.onload=function(){l&&l();b()}}}};u.prototype={isAvailable:function(){return!0},getStorage:function(){},hasItem:function(a){},getItem:function(a){},setItem:function(a,b){},removeItem:function(a){},getIsDebug:function(){return this.debug},getIsAvailable:function(){return this.available}};l.prototype=Object.create(u.prototype);l.prototype.constructor=l;l.prototype.parent=
u.prototype;l.prototype.isAvailable=function(){return"string"===typeof document.cookie};l.prototype.getStorage=function(){return null};l.prototype.hasItem=function(a){var b=!1;try{b=(new RegExp("(?:^|;\\s*)"+encodeURIComponent(a).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=")).test(document.cookie)}catch(c){if(this.debug)throw c;}return b};l.prototype.getItem=function(a){var b=null;try{b=decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*"+encodeURIComponent(a).replace(/[\-\.\+\*]/g,
"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null}catch(c){if(this.debug)throw c;}return b};l.prototype.setItem=function(a,b,c,f,e,d){var g=!1;try{if(!a||/^(?:expires|max\-age|path|domain|secure)$/i.test(a))return g;var k="";if(c)switch(c.constructor){case Number:k=Infinity===c?"; expires=Fri, 31 Dec 9999 23:59:59 GMT":"; max-age="+c;break;case String:k="; expires="+c;break;case Date:k="; expires="+c.toUTCString()}document.cookie=encodeURIComponent(a)+"="+encodeURIComponent(b)+k+(e?"; domain="+
e:"")+(f?"; path="+f:"")+(d?"; secure":"");g=!0}catch(l){if(this.debug)throw l;}return g};l.prototype.removeItem=function(a,b,c){var f=!1;try{if(!a||!this.hasItem(a))return!1;document.cookie=encodeURIComponent(a)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT"+(c?"; domain="+c:"")+(b?"; path="+b:"");f=!0}catch(e){if(this.debug)throw e;}return f};p.prototype=Object.create(u.prototype);p.prototype.constructor=p;p.prototype.parent=u.prototype;p.prototype.isAvailable=function(){var a,b=!1;try{a=window.localStorage,
a.setItem("__storage_test__","__storage_test__"),a.removeItem("__storage_test__"),b=!0}catch(c){if(this.debug)throw c;}return b};p.prototype.getStorage=function(){return window.localStorage};p.prototype.hasItem=function(a){var b=!1;try{b=null!==this.getStorage().getItem(a)}catch(c){if(this.debug)throw c;}return b};p.prototype.getItem=function(a){var b=null;try{b=this.getStorage().getItem(a)}catch(c){if(this.debug)throw c;}return b};p.prototype.setItem=function(a,b){var c=!1;try{this.getStorage().setItem(a,
b),c=!0}catch(f){if(this.debug)throw f;}return c};p.prototype.removeItem=function(a){var b=!1;try{if(!a||!this.hasItem(a))return!1;this.getStorage().removeItem(a);b=!0}catch(c){if(this.debug)throw c;}return b};x.prototype={getUUID:function(a){var b=this.getStoredFp(a);if(!1===b||""===b||null===b)b=this.generateUUID(),this.storeFp(a,b);return b},generateUUID:function(){return d.generateUUID()},getStoredFp:function(a){var b="",c=new p(this.debug),f=new l(this.debug);c.isAvailable()&&c.hasItem(a)&&(b=
c.getItem(a));""!==b&&null!==b||!f.isAvailable()||(b=f.getItem(a));return b},storeFp:function(a,b){var c=!1,f=!1,e=new p(this.debug),d=new l(this.debug);e.isAvailable()&&(c=e.setItem(a,b));d.isAvailable()&&(f=d.setItem(a,b,Infinity,"/"));return c||f}};g.prototype.init=function(){if(!this.isAlreadyLoaded()){var a=new l(r);if(!a.hasItem(this.cookieName)||this.cookieValueOptOut!==a.getItem(this.cookieName)){this.uid=d.generateUUID();this.uidFp=(new x(r)).getUUID(this.cookieFp);this.parseConfig();var b=
this,c=function(){b.initHit();!0===b.config.allowCookieMatch&&b.initCookieMatch();!0===b.config.allowExtLinksTrack&&b.initExtLinksTrack();!0===b.config.allowPresenceTrack&&b.initPresenceTrack();b.initActionCycle()};if(!0===this.config.allowDspTrack){this.initDspTrack();var f=function(){!1===b.dspTrack.ready&&b.dspTrack.nofRequests<b.dspTrack.maxNofRequests?(b.dspTrack.nofRequests++,setTimeout(f,b.dspTrack.timeout)):c()};f()}else c()}}};g.prototype.initHit=function(){var a=d.makeRequestUri(this.urlHit,
this.collectDataOnInit());d.makeRequestImage(a,r)};g.prototype.initActionCycle=function(a){if(void 0===a&&this.config.action){var b=this.config.action,c=this.action,d;if("string"===typeof b&&"{"===b[0])try{b=JSON.parse(b)}catch(e){b={}}for(d=0;d<c.userCanReset.length;d++){var h=c.userCanReset[d];b.hasOwnProperty(h)&&(c[h]=b[h])}r&&n&&(n.owner_id?console.log("acint: aci_action.owner_id is ["+n.owner_id+"]"):console.warn("acint: aci_action.owner_id is not defined!"))}var g=this;setTimeout(function(){g.processActionData()},
a||0)};g.prototype.processActionData=function(){var a=this.action;!n&&s._aci_action&&(n=s._aci_action);if(n&&d.isArray(n)){if(n.length){for(var b=0;a.index<n.length;){var c=n[a.index];a.index++;if("object"===typeof c&&c.hasOwnProperty("length"))if(c.length)for(var f=0;f<c.length;f++)this.processAction(c[f]),b++;else this.processAction(void 0),b++;else this.processAction(c),b++;if(b>=a.countPerCycle)break}r&&b&&console.log(d.getDateTimeIso8601(!1)+": processed "+b+" actions")}this.initActionCycle(a.timeout)}else r&&
console.log(d.getDateTimeIso8601(!1)+": no _aci_action"),a.timeoutEmpty&&(this.initActionCycle(a.timeoutEmpty),a.timeoutEmpty=0)};g.prototype.processAction=function(a){var b=this.action;switch(typeof a){case "function":a="#function";break;case "undefined":a="#undefined"}a={owner_id:n.owner_id?n.owner_id:null,action:a};var c=this.collectDataOnAction();c.ad=d.encodeUriParam(d.stringTrimLimit(v.stringify(a)));null!==this.config.customData&&(c.cd=d.encodeUriParam(d.stringTrimLimit(this.config.customData)));
b=d.makeRequestUri(this.urlAct+b.methods.register,c);d.makeRequestImage(b,r)};g.prototype.initCookieMatch=function(){var a=d.makeRequestUri(this.urlMatchCookie,this.collectDataOnCookieMatch());d.makeRequestIframe(a)};g.prototype.initExtLinksTrack=function(){var a=this,b=document,c=function(b){var c=window,h=!1,g;b=b||c.event;var k=b.target||b.srcElement,l=k;if(!("tagName"in k&&"a"==k.tagName.toLowerCase())){for(h=k.parentNode;h;){if("tagName"in h&&"a"==h.tagName.toLowerCase()){g=h;break}if("parentNode"in
h)h=h.parentNode;else break}if(g)k=g;else return}if("href"in k&&/^(http:|https:|)\/\/.+/.test(k.href)&&!("hostname"in k&&k.hostname===c.location.hostname)){if(b.shiftKey||b.altKey||b.ctrlKey||b.metaKey)h=!0;h=!0;k.hasOwnProperty("_delayClick")?!1===k.hasOwnProperty("_canSkipDelay")?"preventDefault"in b?b.preventDefault():b.returnValue=!1:(delete k._canSkipDelay,delete k._delayClick):(c=d.makeRequestUri(a.urlJump,a.collectDataOnClick(b,k)),d.makeRequestImage(c,r),!1===h&&(k._delayClick=!0,setTimeout(function(){k._canSkipDelay=
!0;d.fireSameEventCrosBrowser(l,"click",b)},200),"preventDefault"in b?b.preventDefault():b.returnValue=!1))}};"interactive"==b.readyState||"complete"==b.readyState?d.addEventListenerCrossBrowser(b.body,"click",c):d.bindOnReady(function(){d.addEventListenerCrossBrowser(b.body,"click",c)})};g.prototype.initPresenceTrack=function(){var a=this,b=function(){var c=d.makeRequestUri(a.urlPing,a.collectDataOnPresencePing());d.makeRequestImage(c,r);a.presence.nofRequests+=1;a.presence.nofRequests<a.presence.timeouts.length&&
setTimeout(b,a.presence.timeouts[a.presence.nofRequests])};setTimeout(b,this.presence.timeouts[0])};g.prototype.initDspTrack=function(){var a=this,b="cbrid_"+(new Date).getTime();window[b]=function(c){a.dspTrack.bidRequestId=c;a.dspTrack.ready=!0;delete window[b]};var c=d.makeRequestUri(a.urlRid,{cb:b});d.makeRequestScript(c)};g.prototype.isAlreadyLoaded=function(){if("object"==typeof s._acil&&"function"==typeof s._acil.isLoaded)return!0;"undefined"!==typeof Object.defineProperty?(d.addReadOnlyProperty(s,
"_acil",{}),d.addReadOnlyProperty(s._acil,"isLoaded",function(){return!0})):s._acil=function(){return{isLoaded:function(){return!0}}}();return!1};g.prototype.parseConfig=function(){if(d.isObject(m)&&!d.isEmptyObject(m)){var a=["dataProvider"],b=["allowExtLinksTrack","allowPresenceTrack","allowCookieMatch","allowDspTrack"],c=["customData"],f=["action"],e,h;for(h=0;h<a.length;h++)e=a[h],m.hasOwnProperty(e)&&(this.config[e]=isNaN(parseInt(m[e],10))?this.config[e]:Math.abs(parseInt(m[e],10)));for(h=0;h<
b.length;h++)e=b[h],m.hasOwnProperty(e)&&(this.config[e]=!0===m[e]);for(h=0;h<c.length;h++)if(e=c[h],m.hasOwnProperty(e)&&(a=m[e],!("undefined"===typeof a||null==a||"function"==typeof a||d.isString(a)&&0===a.length||d.isObject(a)&&d.isEmptyObject(a)||d.isArray(a)&&0===a.length))){try{if(d.isObject(a)||d.isArray(a)){if(a=v.stringify(a),"{}"===a||"[]"===a)a=null}else d.isString(a)||(a=a.toString(),0===a.length&&(a=null))}catch(g){if(a=null,!0===w)throw g;}this.config[e]=a}for(h=0;h<f.length;h++)e=f[h],
m.hasOwnProperty(e)&&(this.config[e]=m[e])}};g.prototype.dataAddObligatoryParams=function(a){a.v=this.version;a.uid=this.uid;a.dp=this.config.dataProvider;a.tz=d.encodeUriParam(d.getTimeZoneOffsetIso8601());a.nc=Math.random().toString().substr(2,8);!0===this.config.allowDspTrack&&(a.brid=d.encodeUriParam(d.stringTrimLimit(this.dspTrack.bidRequestId)));return a};g.prototype.collectDataOnInit=function(){var a=document,b=window,c=this.dataAddObligatoryParams({});c.u=d.encodeUriParam(d.stringTrimLimit(b.location.href));
c.r=d.encodeUriParam(d.stringTrimLimit(a.referrer||""));c.rs=b.screen.width+"x"+b.screen.height;c.t=d.encodeUriParam(d.stringTrimLimit(a.title));c.oE=+this.config.allowExtLinksTrack;c.oP=+this.config.allowPresenceTrack;c.dT=d.encodeUriParam(d.getDateTimeIso8601(!1));c.fu=this.uidFp;null!==this.config.customData&&(c.cd=d.encodeUriParam(d.stringTrimLimit(this.config.customData)));b.parent!==b&&(c["if"]=d.encodeUriParam(b.location.href),c.u=d.encodeUriParam(a.referrer||""),c.r="");return c};g.prototype.collectDataOnCookieMatch=
function(){return{dp:this.config.dataProvider}};g.prototype.collectDataOnClick=function(a,b){var c=document,f=window,c=a.target.ownerDocument||c,e=c.documentElement,h=c.body,c=this.dataAddObligatoryParams({});c.u="";c.r="";c.vP="";c.c="";c.aT="";c.hT=0;c.vP=(f.innerWidth||e.clientWidth||h.clientWidth)+"x"+(f.innerHeight||e.clientHeight||h.clientHeight);null==a.pageX&&null!=a.clientX?c.c=a.clientX+(e&&e.scrollLeft||h&&h.scrollLeft||0)-(e&&e.clientLeft||h&&h.clientLeft||0)+"x"+(a.clientY+(e&&e.scrollTop||
h&&h.scrollTop||0)-(e&&e.clientTop||h&&h.clientTop||0)):null!==a.pageX&&(c.c=a.pageX+"x"+a.pageY);c.r=d.encodeUriParam(d.stringTrimLimit(f.location.href));c.u=d.encodeUriParam(d.stringTrimLimit(b.href));var f=b.childNodes,g=0,k=0,l=0;if(1<=f.length){for(e=0;e<f.length;e++)h=f[e],3!==h.nodeType&&1!==h.nodeType||1!==h.nodeType||(k+=1,"tagName"in f[e]&&"img"===f[e].tagName.toLowerCase()&&(g+=1,l=e));1==g&&g==k?c.hT=1:0<k&&(c.hT=2)}switch(c.hT){case 1:c.aT=f[l].getAttribute("alt")||"";break;case 2:case 0:c.aT=
b.innerHTML?b.innerHTML.toString().replace(/<\/?[^>]+>/gmi,""):""}0<c.aT.length&&(c.aT=d.stringTrimLimit(c.aT),""!==c.aT&&(c.aT=/^(\S+(\s|)){1,10}/gmi.exec(c.aT)[0].replace(/^\s+|\s+$/g,"")));c.aT=d.encodeUriParam(c.aT);return c};g.prototype.collectDataOnPresencePing=function(){var a=this.dataAddObligatoryParams({});a.dT=d.encodeUriParam(d.getDateTimeIso8601(!1));return a};g.prototype.collectDataOnAction=function(a){a||(a={});a=this.dataAddObligatoryParams(a);a.dT=d.encodeUriParam(d.getDateTimeIso8601(!1));
return a};try{(new g).init()}catch(y){if(!0===r)throw y;}});
